package io.github.talelin.latticy.controller.v1;


import io.github.talelin.core.annotation.GroupRequired;
import io.github.talelin.core.annotation.LoginRequired;
import io.github.talelin.core.annotation.PermissionMeta;
import io.github.talelin.core.annotation.PermissionModule;
import io.github.talelin.latticy.common.util.PageUtil;
import io.github.talelin.latticy.dto.putaway.PutAwayDTO;
import io.github.talelin.latticy.dto.stock.BatchStockDTO;
import io.github.talelin.latticy.dto.stock.BatchStockPageDTO;
import io.github.talelin.latticy.dto.stock.BatchStockVO;
import io.github.talelin.latticy.model.BatchStockDO;
import io.github.talelin.latticy.service.BatchStockService;
import io.github.talelin.latticy.vo.CreatedVO;
import io.github.talelin.latticy.vo.PageResponseVO;
import io.github.talelin.latticy.vo.UpdatedVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 批次库存前端控制器
 *
 * @author generator@wulongbo
 * @since 2022-06-28
 */
@RestController
@RequestMapping("/v1/batchStock")
@PermissionModule(value = "批次库存")
public class BatchStockController {

    @Resource
    private BatchStockService batchStockService;

    /**
     * 按sku查询库存
     *
     * @param batchStockPageDTO
     * @return
     */
    @GetMapping("/getBatchStockBySku")
    @PermissionMeta(value = "按sku查询库存")
    @LoginRequired
    public PageResponseVO<BatchStockVO> getBatchStockBySku(@Validated BatchStockPageDTO batchStockPageDTO) {
        return PageUtil.build(batchStockService.getBatchStockBySku(batchStockPageDTO));
    }

}
